Jan and July max temperature
tmax_jan_july = select(ny_noaa_cleaned, id, year, month, tmax, tmin, prcp) %>%
filter(month == "01" | month == "07") %>%
mutate(month = factor(month, labels = c("Jan", "July"))) %>%
group_by(id, year, month) %>%
summarize(mean_tmax = mean(tmax, na.rm = TRUE),
mean_tmin = mean(tmin, na.rm = TRUE),
mean_prcp = mean(prcp, na.rm = TRUE))
tmax_jan_july %>%
mutate(text_label = str_c('Year: ', year, ' MaxTemp: ', mean_tmax, ' C')) %>%
plot_ly(x = ~year, y = ~mean_tmax, type = "scatter", mode = "markers",
alpha = 0.5,
color = ~month,
text = ~text_label)
## Warning: Ignoring 361 observations
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels